{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# This information helps with debugging and getting support :)\n",
"import sys, platform\n",
"import pandas as pd\n",
"import bifacial_radiance as br\n",
"print(\"Working on a \", platform.system(), platform.release())\n",
"print(\"Python version \", sys.version)\n",
"print(\"Pandas version \", pd.__version__)\n",
"print(\"bifacial_radiance version \", br.__version__)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# 13 - Modeling Modules with Glass\n",
"\n",
"\n",
"This journal shows how to add glass to the modules. It also shows how to sample irradiance on the surface of the glass, as well as on the surface of the module. Surface of the module is slightlyt less irradiance due to fresnel losses (a.k.a. Angle of Incidence losses (AOI))\n",
"\n",
"Some examples of the module with glass we'll create:\n",
"\n",
"\n",
"\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Your simulation will be stored in C:\\Users\\mprillim\\sam_dev\\bifacial_radiance\\bifacial_radiance\\TEMP\\Tutorial_13\n"
]
}
],
"source": [
"import os\n",
"from bifacial_radiance import *\n",
"from pathlib import Path\n",
"\n",
"testfolder = str(Path().resolve().parent.parent / 'bifacial_radiance' / 'TEMP' / 'Tutorial_13')\n",
"if not os.path.exists(testfolder):\n",
" os.makedirs(testfolder)\n",
"\n",
"print (\"Your simulation will be stored in %s\" % testfolder)\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"path = C:\\Users\\mprillim\\sam_dev\\bifacial_radiance\\bifacial_radiance\\TEMP\\Tutorial_13\n",
"Loading albedo, 1 value(s), 0.300 avg\n",
"1 nonzero albedo values.\n",
"Getting weather file: USA_VA_Richmond.724010_TMY2.epw\n",
" ... OK!\n",
"8760 line in WeatherFile. Assuming this is a standard hourly WeatherFile for the year for purposes of saving Gencumulativesky temporary weather files in EPW folder.\n",
"Coercing year to 2021\n",
"Saving file EPWs\\metdata_temp.csv, # points: 8760\n",
"Calculating Sun position for Metdata that is right-labeled with a delta of -30 mins. i.e. 12 is 11:30 sunpos\n"
]
},
{
"data": {
"text/plain": [
"'skies\\\\sky2_37.5_-77.33_2021-01-01_1600.rad'"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"demo = RadianceObj('tutorial_13',str(testfolder)) \n",
"demo.setGround(0.30) # This prints available materials.\n",
"epwfile = demo.getEPW(lat = 37.5, lon = -77.6) # This location corresponds to Richmond, VA.\n",
"metdata = demo.readWeatherFile(epwfile) \n",
"demo.gendaylit(8) # January 1 4pm (timepoint # 8)\\\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Modeling example with glass"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Module Name: test-module\n",
"\n",
"Warning: module glass increases analysis variability. Recommend setting `accuracy='high'` in AnalysisObj.analysis().\n",
"\n",
"Module test-module updated in module.json\n",
"Pre-existing .rad file objects\\test-module.rad will be overwritten\n",
"\n",
"\n",
"Warning: module glass increases analysis variability. Recommend setting `accuracy='high'` in AnalysisObj.analysis().\n",
"\n",
"Module was shifted by 0.078 in X to avoid sensors on air\n",
"This is a Cell-Level detailed module with Packaging Factor of 0.81 %\n",
"Module test-module updated in module.json\n",
"Pre-existing .rad file objects\\test-module.rad will be overwritten\n",
"\n",
"Created tutorial_13.oct\n"
]
}
],
"source": [
"module_type = 'test-module' \n",
"\n",
"numcellsx = 6\n",
"numcellsy = 12\n",
"xcell = 0.156\n",
"ycell = 0.156\n",
"xcellgap = 0.02\n",
"ycellgap = 0.02\n",
"\n",
"visible = True\n",
"diameter = 0.15\n",
"tubetype = 'round'\n",
"material = 'Metal_Grey'\n",
"xgap = 0.1\n",
"ygap = 0\n",
"zgap = 0.05\n",
"numpanels = 1\n",
"axisofrotationTorqueTube = False\n",
"glass = True\n",
"\n",
"cellLevelModuleParams = {'numcellsx': numcellsx, 'numcellsy':numcellsy, \n",
" 'xcell': xcell, 'ycell': ycell, 'xcellgap': xcellgap, 'ycellgap': ycellgap}\n",
"\n",
"mymodule = demo.makeModule(name=module_type, x=1, y=1, xgap=xgap, ygap=ygap, \n",
" zgap=zgap, numpanels=numpanels, glass=glass, z=0.0002)\n",
"mymodule.addTorquetube(material=material, tubetype=tubetype, diameter=diameter,\n",
" axisofrotation=axisofrotationTorqueTube, recompile=False)\n",
"mymodule.addCellModule(**cellLevelModuleParams)\n",
"\n",
"sceneDict = {'tilt':0,'pitch':5.5,'hub_height':1.0,'azimuth':90, 'nMods': 20, 'nRows': 1, 'originx':0, 'originy':0} \n",
"scene = demo.makeScene(module_type, sceneDict)\n",
"octfile = demo.makeOct(demo.getfilelist()) "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Advanced Rendering:\n",
"\n",
"The images at the beginning of the journal can be made pretty with advanced rendering. This is the workflow:\n",
"\n",
" rvu -> rpict -> pcond -> pfilt -> ra_tiff -> convert\n",
"\n",
"In detail:\n",
"\n",
"***1. Use rvu to view the oct file***\n",
"\n",
" rvu 1axis_07_01_08.oct \n",
"\n",
"Use aim and origin to move around, zoom in/out, etc. Save a view file with view render.\n",
"\n",
"***2. Run rpict to render the image to hdr***\n",
"\n",
"This is the time consuming step. It takes between 1 and 3 hours depending on how complex the geometry is.\n",
"\n",
" rpict -x 4800 -y 4800 -i -ps 1 -dp 530 -ar 964 -ds 0.016 -dj 1 -dt 0.03 -dc 0.9 -dr 5 -st 0.12 -ab 5 -aa 0.11 -ad 5800 -as 5800 -av 25 25 25 -lr 14 -lw 0.0002 -vf render.vf bifacial_example.oct > render.hdr\n",
"\n",
"\n",
"***3. Run pcond to mimic human visual response***\n",
"\n",
" pcond -h render.hdr > render.pcond.hdr\n",
"\n",
"\n",
"***4. Resize and adjust exposure with pfilt***\n",
"\n",
" pfilt -e +0.2 -x /4 -y /4 render.pcond.hdr > render.pcond.pfilt.hdr\n",
"\n",
"\n",
"***5. Convert hdr to tif***\n",
"\n",
" ra_tiff render.pcond.pfilt.hdr render.tif\n",
"\n",
"\n",
"***6. Convert tif to png with imagemagick convert utility***\n",
"\n",
" convert render.tif render.png\n",
"\n",
"\n",
"***7. Annotate the image with convert***\n",
"\n",
" convert render.png -fill black -gravity South -annotate +0+5 'Created with NREL bifacial_radiance https://github.com/NatLabRockies/bifacial_radiance' render_annotated.png\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"analysis = AnalysisObj(octfile, demo.basename)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Scanning Outside of the module, the surface of the glass"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Linescan in process: tutorial_13_Row1_Module10_Front\n",
"Linescan in process: tutorial_13_Row1_Module10_Back\n",
"Saved: results\\irr_tutorial_13_Row1_Module10.csv\n"
]
},
{
"data": {
"text/html": [
"
\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" x | \n",
" y | \n",
" z | \n",
" rearZ | \n",
" mattype | \n",
" rearMat | \n",
" Wm2Front | \n",
" Wm2Back | \n",
" Back/FrontRatio | \n",
" rearX | \n",
" rearY | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" 0.837 | \n",
" 0.0 | \n",
" 1.006 | \n",
" 0.995 | \n",
" a9.0.a2.1.0.cellPVmodule.6457 | \n",
" a9.0.a0.test-module_Glass.2310 | \n",
" 86.163 | \n",
" 12.782 | \n",
" 0.148 | \n",
" 0.837 | \n",
" 0.0 | \n",
"
\n",
" \n",
" | 1 | \n",
" 0.628 | \n",
" 0.0 | \n",
" 1.006 | \n",
" 0.995 | \n",
" a9.0.a2.2.0.cellPVmodule.6457 | \n",
" a9.0.a0.test-module_Glass.2310 | \n",
" 86.164 | \n",
" 12.161 | \n",
" 0.141 | \n",
" 0.628 | \n",
" 0.0 | \n",
"
\n",
" \n",
" | 2 | \n",
" 0.418 | \n",
" 0.0 | \n",
" 1.006 | \n",
" 0.995 | \n",
" a9.0.a2.3.0.cellPVmodule.6457 | \n",
" a9.0.a0.test-module_Glass.2310 | \n",
" 86.165 | \n",
" 11.420 | \n",
" 0.133 | \n",
" 0.418 | \n",
" 0.0 | \n",
"
\n",
" \n",
" | 3 | \n",
" 0.209 | \n",
" 0.0 | \n",
" 1.006 | \n",
" 0.995 | \n",
" a9.0.a2.4.0.cellPVmodule.6457 | \n",
" a9.0.a0.test-module_Glass.2310 | \n",
" 86.166 | \n",
" 10.508 | \n",
" 0.122 | \n",
" 0.209 | \n",
" 0.0 | \n",
"
\n",
" \n",
" | 4 | \n",
" 0.000 | \n",
" 0.0 | \n",
" 1.006 | \n",
" 0.995 | \n",
" a9.0.a0.test-module_Glass.6457 | \n",
" a9.0.a0.test-module_Glass.2310 | \n",
" 85.927 | \n",
" 28.141 | \n",
" 0.327 | \n",
" 0.000 | \n",
" 0.0 | \n",
"
\n",
" \n",
" | 5 | \n",
" -0.209 | \n",
" 0.0 | \n",
" 1.006 | \n",
" 0.995 | \n",
" a9.0.a2.7.0.cellPVmodule.6457 | \n",
" a9.0.a0.test-module_Glass.2310 | \n",
" 86.168 | \n",
" 10.991 | \n",
" 0.128 | \n",
" -0.209 | \n",
" 0.0 | \n",
"
\n",
" \n",
" | 6 | \n",
" -0.419 | \n",
" 0.0 | \n",
" 1.006 | \n",
" 0.995 | \n",
" a9.0.a2.8.0.cellPVmodule.6457 | \n",
" a9.0.a0.test-module_Glass.2310 | \n",
" 86.169 | \n",
" 11.858 | \n",
" 0.138 | \n",
" -0.419 | \n",
" 0.0 | \n",
"
\n",
" \n",
" | 7 | \n",
" -0.628 | \n",
" 0.0 | \n",
" 1.006 | \n",
" 0.995 | \n",
" a9.0.a2.9.0.cellPVmodule.6457 | \n",
" a9.0.a0.test-module_Glass.2310 | \n",
" 86.170 | \n",
" 12.704 | \n",
" 0.147 | \n",
" -0.628 | \n",
" 0.0 | \n",
"
\n",
" \n",
" | 8 | \n",
" -0.837 | \n",
" 0.0 | \n",
" 1.006 | \n",
" 0.995 | \n",
" a9.0.a2.10.0.cellPVmodule.6457 | \n",
" a9.0.a0.test-module_Glass.2310 | \n",
" 86.171 | \n",
" 13.369 | \n",
" 0.155 | \n",
" -0.837 | \n",
" 0.0 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" x y z rearZ mattype \\\n",
"0 0.837 0.0 1.006 0.995 a9.0.a2.1.0.cellPVmodule.6457 \n",
"1 0.628 0.0 1.006 0.995 a9.0.a2.2.0.cellPVmodule.6457 \n",
"2 0.418 0.0 1.006 0.995 a9.0.a2.3.0.cellPVmodule.6457 \n",
"3 0.209 0.0 1.006 0.995 a9.0.a2.4.0.cellPVmodule.6457 \n",
"4 0.000 0.0 1.006 0.995 a9.0.a0.test-module_Glass.6457 \n",
"5 -0.209 0.0 1.006 0.995 a9.0.a2.7.0.cellPVmodule.6457 \n",
"6 -0.419 0.0 1.006 0.995 a9.0.a2.8.0.cellPVmodule.6457 \n",
"7 -0.628 0.0 1.006 0.995 a9.0.a2.9.0.cellPVmodule.6457 \n",
"8 -0.837 0.0 1.006 0.995 a9.0.a2.10.0.cellPVmodule.6457 \n",
"\n",
" rearMat Wm2Front Wm2Back Back/FrontRatio rearX \\\n",
"0 a9.0.a0.test-module_Glass.2310 86.163 12.782 0.148 0.837 \n",
"1 a9.0.a0.test-module_Glass.2310 86.164 12.161 0.141 0.628 \n",
"2 a9.0.a0.test-module_Glass.2310 86.165 11.420 0.133 0.418 \n",
"3 a9.0.a0.test-module_Glass.2310 86.166 10.508 0.122 0.209 \n",
"4 a9.0.a0.test-module_Glass.2310 85.927 28.141 0.327 0.000 \n",
"5 a9.0.a0.test-module_Glass.2310 86.168 10.991 0.128 -0.209 \n",
"6 a9.0.a0.test-module_Glass.2310 86.169 11.858 0.138 -0.419 \n",
"7 a9.0.a0.test-module_Glass.2310 86.170 12.704 0.147 -0.628 \n",
"8 a9.0.a0.test-module_Glass.2310 86.171 13.369 0.155 -0.837 \n",
"\n",
" rearY \n",
"0 0.0 \n",
"1 0.0 \n",
"2 0.0 \n",
"3 0.0 \n",
"4 0.0 \n",
"5 0.0 \n",
"6 0.0 \n",
"7 0.0 \n",
"8 0.0 "
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"frontscan, backscan = analysis.moduleAnalysis(scene)\n",
"results = analysis.analysis(octfile, demo.basename, frontscan, backscan) \n",
"load.read1Result('results\\irr_tutorial_13_Row1_Module10.csv')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Scanning Inside of the module, the surface of the cells"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Linescan in process: tutorial_13_Row1_Module10_Front\n",
"Linescan in process: tutorial_13_Row1_Module10_Back\n",
"Saved: results\\irr_tutorial_13_Row1_Module10.csv\n"
]
},
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" x | \n",
" y | \n",
" z | \n",
" rearZ | \n",
" mattype | \n",
" rearMat | \n",
" Wm2Front | \n",
" Wm2Back | \n",
" Back/FrontRatio | \n",
" rearX | \n",
" rearY | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" 0.837 | \n",
" 0.0 | \n",
" 1.051 | \n",
" 0.95 | \n",
" a9.0.a2.1.0.cellPVmodule.6457 | \n",
" a9.0.a0.test-module_Glass.2310 | \n",
" 86.157 | \n",
" 12.887 | \n",
" 0.150 | \n",
" 0.837 | \n",
" 0.0 | \n",
"
\n",
" \n",
" | 1 | \n",
" 0.628 | \n",
" 0.0 | \n",
" 1.051 | \n",
" 0.95 | \n",
" a9.0.a2.2.0.cellPVmodule.6457 | \n",
" a9.0.a0.test-module_Glass.2310 | \n",
" 86.158 | \n",
" 12.266 | \n",
" 0.142 | \n",
" 0.628 | \n",
" 0.0 | \n",
"
\n",
" \n",
" | 2 | \n",
" 0.418 | \n",
" 0.0 | \n",
" 1.051 | \n",
" 0.95 | \n",
" a9.0.a2.3.0.cellPVmodule.6457 | \n",
" a9.0.a0.test-module_Glass.2310 | \n",
" 86.159 | \n",
" 11.481 | \n",
" 0.133 | \n",
" 0.418 | \n",
" 0.0 | \n",
"
\n",
" \n",
" | 3 | \n",
" 0.209 | \n",
" 0.0 | \n",
" 1.051 | \n",
" 0.95 | \n",
" a9.0.a2.4.0.cellPVmodule.6457 | \n",
" a9.0.a0.test-module_Glass.2310 | \n",
" 86.160 | \n",
" 10.462 | \n",
" 0.121 | \n",
" 0.209 | \n",
" 0.0 | \n",
"
\n",
" \n",
" | 4 | \n",
" 0.000 | \n",
" 0.0 | \n",
" 1.051 | \n",
" 0.95 | \n",
" a9.0.a0.test-module_Glass.6457 | \n",
" a9.0.a0.test-module_Glass.2310 | \n",
" 85.921 | \n",
" 28.141 | \n",
" 0.328 | \n",
" 0.000 | \n",
" 0.0 | \n",
"
\n",
" \n",
" | 5 | \n",
" -0.209 | \n",
" 0.0 | \n",
" 1.051 | \n",
" 0.95 | \n",
" a9.0.a2.7.0.cellPVmodule.6457 | \n",
" a9.0.a0.test-module_Glass.2310 | \n",
" 86.162 | \n",
" 10.956 | \n",
" 0.127 | \n",
" -0.209 | \n",
" 0.0 | \n",
"
\n",
" \n",
" | 6 | \n",
" -0.419 | \n",
" 0.0 | \n",
" 1.051 | \n",
" 0.95 | \n",
" a9.0.a2.8.0.cellPVmodule.6457 | \n",
" a9.0.a0.test-module_Glass.2310 | \n",
" 86.163 | \n",
" 11.831 | \n",
" 0.137 | \n",
" -0.419 | \n",
" 0.0 | \n",
"
\n",
" \n",
" | 7 | \n",
" -0.628 | \n",
" 0.0 | \n",
" 1.051 | \n",
" 0.95 | \n",
" a9.0.a2.9.0.cellPVmodule.6457 | \n",
" a9.0.a0.test-module_Glass.2310 | \n",
" 86.164 | \n",
" 12.698 | \n",
" 0.147 | \n",
" -0.628 | \n",
" 0.0 | \n",
"
\n",
" \n",
" | 8 | \n",
" -0.837 | \n",
" 0.0 | \n",
" 1.051 | \n",
" 0.95 | \n",
" a9.0.a2.10.0.cellPVmodule.6457 | \n",
" a9.0.a0.test-module_Glass.2310 | \n",
" 86.165 | \n",
" 13.377 | \n",
" 0.155 | \n",
" -0.837 | \n",
" 0.0 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" x y z rearZ mattype \\\n",
"0 0.837 0.0 1.051 0.95 a9.0.a2.1.0.cellPVmodule.6457 \n",
"1 0.628 0.0 1.051 0.95 a9.0.a2.2.0.cellPVmodule.6457 \n",
"2 0.418 0.0 1.051 0.95 a9.0.a2.3.0.cellPVmodule.6457 \n",
"3 0.209 0.0 1.051 0.95 a9.0.a2.4.0.cellPVmodule.6457 \n",
"4 0.000 0.0 1.051 0.95 a9.0.a0.test-module_Glass.6457 \n",
"5 -0.209 0.0 1.051 0.95 a9.0.a2.7.0.cellPVmodule.6457 \n",
"6 -0.419 0.0 1.051 0.95 a9.0.a2.8.0.cellPVmodule.6457 \n",
"7 -0.628 0.0 1.051 0.95 a9.0.a2.9.0.cellPVmodule.6457 \n",
"8 -0.837 0.0 1.051 0.95 a9.0.a2.10.0.cellPVmodule.6457 \n",
"\n",
" rearMat Wm2Front Wm2Back Back/FrontRatio rearX \\\n",
"0 a9.0.a0.test-module_Glass.2310 86.157 12.887 0.150 0.837 \n",
"1 a9.0.a0.test-module_Glass.2310 86.158 12.266 0.142 0.628 \n",
"2 a9.0.a0.test-module_Glass.2310 86.159 11.481 0.133 0.418 \n",
"3 a9.0.a0.test-module_Glass.2310 86.160 10.462 0.121 0.209 \n",
"4 a9.0.a0.test-module_Glass.2310 85.921 28.141 0.328 0.000 \n",
"5 a9.0.a0.test-module_Glass.2310 86.162 10.956 0.127 -0.209 \n",
"6 a9.0.a0.test-module_Glass.2310 86.163 11.831 0.137 -0.419 \n",
"7 a9.0.a0.test-module_Glass.2310 86.164 12.698 0.147 -0.628 \n",
"8 a9.0.a0.test-module_Glass.2310 86.165 13.377 0.155 -0.837 \n",
"\n",
" rearY \n",
"0 0.0 \n",
"1 0.0 \n",
"2 0.0 \n",
"3 0.0 \n",
"4 0.0 \n",
"5 0.0 \n",
"6 0.0 \n",
"7 0.0 \n",
"8 0.0 "
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"frontscan, backscan = analysis.moduleAnalysis(scene, frontsurfaceoffset=0.05, backsurfaceoffset = 0.05)\n",
"results = analysis.analysis(octfile, demo.basename, frontscan, backscan) \n",
"load.read1Result('results\\irr_tutorial_13_Row1_Module10.csv')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.7"
}
},
"nbformat": 4,
"nbformat_minor": 4
}